import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;


public class Logger
{
    private static final boolean on = true;
    private static final String logfile = "log.txt";
    private static PrintWriter writer;
    
    static
    {
        try
        {
            File file = new File("log.txt");
            
            if (!file.exists())
                file.createNewFile();
            
            writer = new PrintWriter(new FileOutputStream(new File(logfile)));
        }
        catch (FileNotFoundException e)
        {
            e.printStackTrace();
        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }
    
    public static void log(String msg)
    {
        if (on)
        {
            writer.println((new Date()).toString() + ": " + msg);
            writer.flush();
        }
    }
}
